<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>父子传值</title>
    <script src="lib/vue.js"></script>
</head>
<body>
<div id="app">
    <my-parent></my-parent>
</div>
</body>
<template id="parent">
    <div>
        <h1>父组件</h1>
        <my-child></my-child>
    </div>
</template>
<template id="child">
    <div>
        <h4>子组件</h4>
    </div>
</template>

<script>
    const Child = {
        template: `#child`
    };
    const Parent = {
        template: `#parent`,
        components: {
            "my-child": Child
        }
    }
    new Vue({
        el: `#app`,
        components: {
            "my-parent": Parent
        }
    })
</script>
</html>